package models

import (
	"github.com/jinzhu/gorm"
	db2 "meituan/db"
)

// Permissions 权限表
type Permissions struct {
	gorm.Model
	Name     string     `gorm:"type:varchar(60)"`
	Menu     []Menus    `gorm:"many2many:permissions2menu"`
	Resouces []Resouces `gorm:"many2many:permissions2resources"`
}

// TableName 设置权限表名称
func (user Permissions) TableName() string {
	return "permissions"
}

func init() {
	db, _ := db2.NewDB()
	defer db.Close()
	db.AutoMigrate(new(Permissions))
}
